﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package org.aswing.plaf.basic.background {
    import flash.display.*;
    import org.aswing.*;
    import flash.filters.*;
    import org.aswing.geom.*;
    import org.aswing.plaf.*;
    import org.aswing.graphics.*;

    public class TextComponentBackBround implements GroundDecorator, UIResource {

        protected var shape:Shape;

        public function TextComponentBackBround(){
            this.shape = new Shape();
        }
        public function updateDecorator(_arg1:Component, _arg2:Graphics2D, _arg3:IntRectangle):void{
            var _local4:ASColor;
            var _local5:StyleTune;
            var _local6:StyleResult;
            var _local7:ASColor;
            var _local8:EditableComponent;
            var _local9:Boolean;
            var _local10:Number;
            this.shape.visible = _arg1.isOpaque();
            if (_arg1.isOpaque()){
                this.shape.graphics.clear();
                _arg2 = new Graphics2D(this.shape.graphics);
                _local4 = _arg1.getBackground();
                _local5 = _arg1.getStyleTune();
                _local6 = new StyleResult(_local4, _local5);
                _local7 = _local6.bdark;
                _local8 = (_arg1 as EditableComponent);
                _local9 = true;
                if (_local8 != null){
                    _local9 = _local8.isEditable();
                };
                if (((!(_arg1.isEnabled())) || (!(_local9)))){
                    _local7 = _local7.changeAlpha((_local7.getAlpha() * this.getChangeSharpen(_arg1.isEnabled(), _local9)));
                    _local4 = _local4.changeAlpha((_local4.getAlpha() * this.getChangeAlpha(_arg1.isEnabled(), _local9)));
                };
                _arg3 = new IntRectangle(0, 0, (_arg1.width - 1), (_arg1.height - 1));
                _local10 = _local5.round;
                if (_local10 >= 1){
                    _arg2.fillRoundRect(new SolidBrush(_local4), _arg3.x, _arg3.y, _arg3.width, _arg3.height, _local10);
                    _arg2.fillRoundRectRingWithThickness(new SolidBrush(_local7), _arg3.x, _arg3.y, _arg3.width, _arg3.height, _local10, 1, (_local10 - 1));
                } else {
                    _arg2.fillRectangle(new SolidBrush(_local4), _arg3.x, _arg3.y, _arg3.width, _arg3.height);
                    _arg2.fillRectangleRingWithThickness(new SolidBrush(_local7), _arg3.x, _arg3.y, _arg3.width, _arg3.height, 1);
                };
                this.shape.filters = [new DropShadowFilter(1, 45, _local4.getRGB(), (_local5.shadowAlpha * _local4.getAlpha()), 0, 0, 1, 1)];
            };
        }
        protected function getChangeSharpen(_arg1:Boolean, _arg2:Boolean):Number{
            if (!_arg1){
                return (0.2);
            };
            if (!_arg2){
                return (1);
            };
            return (1);
        }
        protected function getChangeAlpha(_arg1:Boolean, _arg2:Boolean):Number{
            if (!_arg1){
                return (0.2);
            };
            if (!_arg2){
                return (0.3);
            };
            return (1);
        }
        public function getDisplay(_arg1:Component):DisplayObject{
            return (this.shape);
        }

    }
}//package org.aswing.plaf.basic.background 
